package org.jeecg.modules.inventory.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.jeecg.config.mybatis.BaseMapperPlus;
import org.jeecg.modules.inventory.entity.BussInventoryDetails;
import org.jeecg.modules.inventory.vo.BussInventoryDetailsPageVo;
import org.jeecg.modules.inventory.vo.BussInventoryDetailsVo;

import java.util.List;

/**
 * @Description: 库存明细
 * @Author: jeecg-boot
 * @Date:   2024-07-01
 * @Version: V1.0
 */
public interface BussInventoryDetailsMapper extends BaseMapperPlus<BussInventoryDetails> {

	/**
	 * 通过主表id删除子表数据
	 *
	 * @param mainId 主表id
	 * @return boolean
	 */
	public boolean deleteByMainId(@Param("mainId") String mainId);

  /**
   * 通过主表id查询子表数据
   *
   * @param
   * @return List<BussInventoryDetails>
   */
	public List<BussInventoryDetails> selectByMainId(@Param("warehouseId") String warehouseId,@Param("materialId") String materialId);

	public IPage<BussInventoryDetails> myPage(Page<BussInventoryDetails> page, @Param(Constants.WRAPPER) QueryWrapper<BussInventoryDetails> queryWrapper);


	public IPage<BussInventoryDetailsPageVo> deductPage(Page<BussInventoryDetailsPageVo> page, @Param(Constants.WRAPPER) QueryWrapper<BussInventoryDetailsPageVo> queryWrapper);

	public BussInventoryDetails selectByInfo(@Param("id") String id,@Param("materialId") String materialId,@Param("batch") String batch,@Param("warehouseLocationCode") String warehouseLocationCode);

	public List<BussInventoryDetails> selectByMainIdOrderByTime(@Param("materialId") String materialId,@Param("warehouseId") String warehouseId);

	public BussInventoryDetails selectByStorageId(@Param("storageId") String storageId,@Param("location") String location,@Param("materialId") String materialId,@Param("materialBatchNumber") String materialBatchNumber,@Param("batch") String batch);

	public List<BussInventoryDetails> selectByNoticeMaterial(@Param("id") String id);

	public IPage<BussInventoryDetailsVo> queryWarehouseList(Page<BussInventoryDetailsVo> page, @Param(Constants.WRAPPER) QueryWrapper<BussInventoryDetailsVo> queryWrapper);

	/**
	 * 查询库存
	 * @param page
	 * @param queryWrapper
	 * @return
	 */
	public IPage<BussInventoryDetailsVo> selectKC(Page<BussInventoryDetails> page, @Param(Constants.WRAPPER) QueryWrapper<BussInventoryDetails> queryWrapper);


	public BussInventoryDetails selectByStorageInfo(@Param("storageId") String storageId,@Param("materialId") String materialId);
}
